﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;

namespace StudentsMngDemo.Models
{
    /// <summary>
    /// 学生信息
    /// </summary>
    [Table("Student")]
    public class Student
    {
        /// <summary>
        /// 学生信息主键
        /// </summary>
        [Key]
        [Column("id")]
        [Display(Name = "学生信息主键")]
        public int Id { get; set; }
        /// <summary>
        /// 学籍号
        /// </summary>
        [Column("studentCode")]
        [Display(Name = "学籍号")]
        [Required]
        public long StudentCode { get; set; }
        /// <summary>
        /// 学生姓名
        /// </summary>
        [Column("studentName")]
        [Display(Name = "学生姓名")]
        [MaxLength(50,ErrorMessage ="学生姓名字数不能超过 50 个字")]
        [Required(ErrorMessage = "学生姓名为必填项")]
        public string StudentName { get; set; }
        /// <summary>
        /// 学生年级
        /// </summary>
        [Column("studentGrade")]
        [Display(Name = "学生年级")]
        [Required(ErrorMessage = "学生年级为必填项")]
        public string StudentGrade { get; set; }
        /// <summary>
        /// 学生班级
        /// </summary>
        [Column("studentClass")]
        [Display(Name = "学生班级")]
        [Required(ErrorMessage = "学生班级为必填项")]
        public string StudentClass { get; set; }
        /// <summary>
        /// 性别
        /// </summary>
        [Column("sex")]
        [Display(Name = "性别")]
        public int? Sex { get; set; }
        /// <summary>
        /// 年龄
        /// </summary>
        [Column("age")]
        [Display(Name = "年龄")]
        public int Age { get; set; }
        /// <summary>
        /// 出生日期
        /// </summary>
        [Column("birthTime")]
        [Display(Name = "出生日期")]
        public DateTime? BirthTime { get; set; }
        /// <summary>
        /// 家庭住址
        /// </summary>
        [Column("address")]
        [Display(Name = "家庭住址")]
        public string Address { get; set; }
        /// <summary>
        /// 联系电话
        /// </summary>
        [Column("tel")]
        [Display(Name = "联系电话")]
        public string Tel { get; set; }
        /// <summary>
        /// 创建日期：当前北京时间
        /// </summary>
        [Column("createdDate")]
        [Display(Name = "创建日期")]
        [Required]
        public DateTime CreatedDate { get; set; }= DateTime.UtcNow.AddHours(8);// 当前北京时间
    }
}
